<?php

use Biz\model\brandActivity\JDSigin2020;

/**
 * @deprecated
 * 京东2020双十一签到活动
 * Class JDSiginAction
 */
class JDSiginAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_REGISTER;

    public function main()
    {
        $info = JDSigin2020::getByWhere(['uid' => $this->uid, 'addtime[>=]' => date('Y-m-d'), 'addtime[<]' => date('Y-m-d', strtotime('+1 days'))]);
        if (empty($info)) {
            $addtime = date('Y-m-d H:i:s');
            JDSigin2020::insertData(['uid' => $this->uid, 'addtime' => $addtime]);
        } else {
            throw new \Exception('今日已经签到过了');
        }
        $this->setSuccess(null);
    }
}